1. Technical Field
The present invention relates to a data conversion method for a processor, a method for producing textures to which the processor refers by the data conversion method, a program under which a computer executes these methods, a recording medium, and projector.
2. Related Art
Image processing executed by a computer or other devices includes complicated procedures for data conversion. For example, image processing includes color conversion for converting inputted color representation such as YCbYr into RGB to be outputted, luminance and saturation conversion for fitting colors to be outputted to characteristics of an image display device and user's preference, and other processing. The image processing also involves non-linear data conversion.
Image processing of this type requires real time processing capability, and therefore ICs exclusively used for image processing have been equipped.
However, recent advances in semiconductor technology have made it possible to execute real time image processing by using high-speed, general-purpose and programmable ICs such as a GPU (graphics processing unit).
In image processing by the exclusively used ICs and the general-purpose GPUs discussed above, data conversion using table reference is often adopted so that complicated data conversion can be performed at high speed.
For example, conversion from a certain value X into another value Y is expressed by using a function F as Y=F(X). For simplifying explanation, it is assumed herein that one input corresponds to one output. In reality, however, it is possible that multiple inputs correspond to multiple outputs.
When the function F is expressed in a simple form, the function calculation can be directly executed. However, when the function F has an extremely complicated form, processing speed decreases if the function calculation is executed on each occasion. In addition, it is impossible to apply the function F directly to hardware due to its circuit scale.
In this case, an efficient method to be used is as follows. Assuming that only discrete N inputs are given, a set of N conversion values obtained by the function F each of which is associated with the corresponding one of the N inputs are prepared in the form of table. Then, the process for obtaining the F(X) is replaced with the process for obtaining approximate values by interpolation between values for reading and values actually read from the table.
The method for selecting N discrete inputs used for preparing the table involves equal division and unequal division.
The equal division method divides a possible input range into equal intervals as it is called, and obtains values of the function F corresponding to the respective intervals.
According to this method, both reference to the table and interpolation are easy. However, the range needs to be divided into small intervals so as to increase approximation accuracy in an area of more complicated changes of the function F. It is therefore possible that the produced table becomes redundant on the whole since a number of divisions are included.
The unequal division method solves this problem. The unequal division method divides an area of complicated changes of the function F into small intervals and divides an area of simple changes into large intervals so that a highly accurate table having a small division number can be produced.
However, some consideration is needed to determine the positions in the table corresponding to the given inputs. In addition, more complicated processes are required for interpolation.
When image processing is performed by an exclusively provided IC, these problems arising from the unequal division method are not major obstacles. However, some consideration is needed when a general-purpose GPU having only a reference function for the equal division method is used.
A table readout function in the GPU gives a table as image data called texture constituted by a finite number of pixels disposed at equal intervals, and reads the data by using serial values called texture coordinates.
For reading data corresponding to texture coordinates between the pixels, an interpolation value is produced by way of hardware using pixel values near the texture coordinates.
More specifically, for obtaining a conversion value corresponding to an input value, an interpolation value is automatically produced by way of hardware based on a value given discretely according to equal divisions in the table. In most cases, the reading method is selected from two types: reading method using the nearest data value (NEAREST reading); and reading method using linear interpolation based on a plurality of near data values (LINEAR reading).
A method for referring to the table for unequal division by using this function of the general-purpose GPU has been proposed (for example, see GPU Gems 2, written by Jeremy Selan, compiled by Mate Pharrr published by Addision-Wesley, pp. 381-392, 2005). According to this method, a texture in the form of a table is not directly read by using texture coordinates. Initially, conversion of a texture for converting texture coordinates is executed, and thereafter the texture is indirectly read based on the conversion value.
According to the method disclosed in the above reference, however, it is necessary to select either the NEAREST reading or the LINEAR reading for the interpolation in each interval of the unequal division when the genera-purpose GPU is used. Thus, error is produced in this case.
The only way for reducing the error is to increase the number of division, that is, increase data volume.